package com.hhh.bigevent.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.groups.Default;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author hehehe
 * @since 2025-04-15
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@TableName("category")
@Accessors(chain = true)
@ApiModel(value = "CategoryDO对象", description = "")
public class CategoryDO extends Model<CategoryDO> {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @NotNull(groups = Update.class)
    @ApiModelProperty("ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 分类名称
     */
    @NotEmpty
    @ApiModelProperty("分类名称")
    @TableField("category_name")
    private String categoryName;

    /**
     * 分类别名
     */
    @NotEmpty
    @ApiModelProperty("分类别名")
    @TableField("category_alias")
    private String categoryAlias;

    /**
     * 创建人ID
     */
    @JsonIgnore
    @ApiModelProperty("创建人ID")
    @TableField("create_user")
    private Integer createUser;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("创建时间")
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("修改时间")
    @TableField("update_time")
    private LocalDateTime updateTime;

    public static final String ID = "id";

    public static final String CATEGORY_NAME = "category_name";

    public static final String CATEGORY_ALIAS = "category_alias";

    public static final String CREATE_USER = "create_user";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATE_TIME = "update_time";

    @Override
    public Serializable pkVal() {
        return this.id;
    }

    public interface Update extends Default {

    }
}
